<extend name="Base/common"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/bootstrap.min.css">
<block name="right">
	<div class="main-container">
		<div class="padding-md showmodal">
			<div class="row">
				<div class="col-sm-12">
					<div class="page-title">
						委托信息编辑
					</div>
				</div>
			</div>
			<div class="col-sm-12 row chach">
				<form method="post" action="__SELF__" class="form-hori">
					<p class="c-p1">查新项目信息</p>
					<div class="form-group">
						<label  class="c-p2">查新机构</label><br/>
						<input type="text" data-toggle="modal" data-target="#myModal" id="chose_jg" value="{$jigou}" class="form-control" placeholder="点击可选择机构" style="width: 350px" readonly>
					</div>
					<!-- ================== -->
					<div class="form-group">
						<label  class="c-p2">查新范围<span>*</span></label><br/>
						<label class="radio-inline">
							<input type="radio" name="cxfw" value="1"  onclick="click_name()" {$info['cxfw'] == 1?'checked':''}/>&nbsp&nbsp国内
						</label>
						<label class="radio-inline">
							<input type="radio" name="cxfw" value="2"  onclick="click_name()" {$info['cxfw'] == 2?'checked':''}/>&nbsp&nbsp国外
						</label>
						<label class="radio-inline">
							<input type="radio" name="cxfw" value="3"  onclick="click_name()"  {$info['cxfw'] == 3?'checked':''} />&nbsp&nbsp国内外
						</label>
					</div>
					<!-- ================= -->
					<div class="form-group zhong_name" >
						<label  class="c-p2">项目中文名称<span>*</span></label>
						<input type="text" name="xmmc" class="form-control" placeholder="请输入项目中文名称" value="{$info.xmmc}" >
					</div>
					<!-- ================= -->
					<div class="form-group wai_name" style="display: none" >
						<label  class="c-p2">项目英文名称<span>*</span></label>
						<input type="text" name="xmmcen" class="form-control waiwen" placeholder="国外查新请输入项目英文名称"  value="{$info.xmmcen}">
					</div>
					<!-- =========================================== -->
					<div class="c-inline">
						<div class="c-select" style="width: 600px;">
							<label  class="c-p2">项目所属学科</label>
							<select style="width: 192px;margin-right: 10px;display: inline-block" id="subject_change" class="form-control waiwen">
								<option value="">请选择学科</option>
								<volist name=":getSchoolTypeSelect()" id="vo">
									<eq name="key" value="$info.subject_yj">
										<option value="{$key}" selected="selected">{$vo}</option>
										<else/>
										<option value="{$key}">{$vo}</option>
									</eq>
								</volist>
							</select>
							<span id="sub_list" style="   " >
								<if condition="count($sub_arr) gt 0">
									<label  class="c-p2">二级学科</label>
									<select style="width: 192px;margin-right: 10px;display: inline-block"name="xkfl" class="form-control waiwen">
										<volist name="sub_arr" id="vo">
											<eq name="key" value="$info.subject_xkfl">
												<option value="{$key}" selected="selected">{$vo}</option>
												<else/>
												<option value="{$key}">{$vo}</option>
											</eq>
										</volist>
									</select>
								</if>
							</span>
						</div>
					</div>
					<div class="fenggege"></div>
					<p class="c-p1">查新目的</p>
					<p class="c-p2">查新目的<span>*</span></p>
					<div class="form-group" id="chaxinmudi">
						<label class="checkbox-inline">
							<input type="radio" name="cxmd" value="1" class="show_action" id="other_1" onclick="research(this)" data_dd="1" <if condition="in_array(1,$cxmd_arr)">checked</if>>  科研立项
						</label>
						<label class="checkbox-inline">
							<input type="radio" name="cxmd" value="2" <if condition="in_array(2,$cxmd_arr)">checked</if>> 鉴定、验收、评价
						</label>
						<label class="checkbox-inline">
							<input type="radio" name="cxmd" value="3" <if condition="in_array(3,$cxmd_arr)">checked</if>>  奖励申报
						</label>
						<label class="checkbox-inline">
							<input type="radio" name="cxmd" value="4" <if condition="in_array(4,$cxmd_arr)">checked</if>>  申请专利
						</label>
						<label class="checkbox-inline">
							<input type="radio" name="cxmd" value="5" <if condition="in_array(5,$cxmd_arr)">checked</if>>  博硕士论文开题
						</label>
						<label class="checkbox-inline">
							<input type="radio" name="cxmd" value="7" <if condition="in_array(7,$cxmd_arr)">checked</if>>  申请高新技术企业
						</label>
						<label class="checkbox-inline">
							<input type="radio" name="cxmd" value="8" <if condition="in_array(8,$cxmd_arr)">checked</if>>  申请高新技术产品
						</label>
						<label class="checkbox-inline">
							<input type="radio" name="cxmd" value="6" data_dd="1"id="other_6" onclick="other_mu(this)" <if condition="in_array(6,$cxmd_arr)">checked</if>>  其他
						</label>
						<div id="cxmd_other" style="margin-top:6px;display: none">
							<input type="text" class="form-control chaxin" placeholder="" name="cxmd_other" value="{$info.cxmd_other}">
						</div>
					</div>
					<!-- =========================================== -->
					<div class="form-group" id="xxcxmd" style="display: none">
						<label  class="c-p2">详细查新目的<span>*</span></label>
						<textarea class="form-control xxcxmd " rows="3"  placeholder="科研立项，请填写详细查新目的，如“申报国家自然科学基金项目”" name="xxcxmd" style="height: 200px ;width: 46%"  >{$info.xxcxmd}</textarea>
					</div>

					<!-- =========================================== -->
					<div class="form-group" id="form-group-c1">
						<label  class="c-p2">项目级别<span>*</span></label><br/>
						<volist name=":getLevelRadio()" id="vo">
							<label class="radio-inline">
								<input type="radio" name="xmjb"  value="{$key}" {$info['xmjb'] == $key?'checked':''}> {$vo}
							</label>
						</volist>
					</div>
					<p class="c-p1">查新点与技术要求</p>
					<div class="form-group">
						<label  class="c-p2">查新点<span>*</span></label>
						<textarea class="form-control" rows="3" placeholder="需要查证的内容要点，即与其他类似研究不同之处" name="show_add_cxd" style="height: 200px ;width: 46%"> {$info.show_add_cxd}</textarea>
					</div>
					<!-- =========================================== -->
					<div class="form-group">
						<label  class="c-p2">技术要求<span>*</span></label>
						<textarea class="form-control" rows="3" style="height: 200px ;width: 46%" value="{$info.show_add_cxd}" placeholder="着重说明查新项目的主要科学技术特征、技术参数或指标、结构、生产工艺、配方成份、应用范围、查新委托人自我判断的新颖性等。" name="jsd">{$info.jsd}</textarea>
					</div>
					<!-- =========================================== -->
					<p class="c-p1">查新要求</p>
					<label  class="c-p2">查新要求<span>*</span></label>
					<p class="c-p4">
							<div class="checkbox">
								<div style="margin-left: 20px;" >
									<input type="checkbox" name="cxyq[]" value="1" <if condition="in_array(1,$cxyq)">checked</if>/>希望查新机构通过查新，证明在所查范围内国内外有无相同或类似研究
								</div>
								<div  style="margin-left: 20px;margin-top: 6px">
									<input type="checkbox" name="cxyq[]" value="2" <if condition="in_array(2,$cxyq)">checked</if>/>希望查新机构对查新项目分别或综合进行国内外对比分析
								</div>
								<div style="margin-left: 20px;margin-top: 6px" >
									<input type="checkbox" name="cxyq[]" value="3" onclick="other_cxyq(this)" id='qtyq22'data_dd="1"<if condition="in_array(3,$cxyq)">checked</if> />查新委托人提出的其他愿望
								</div>
							</div>
						<input type="text" class="form-control" placeholder="" style="float: none;width: 740px;display: none" data_dd="1" id='qtyq' name="qtyq" value="{$info.qtyq}">
					</p>
					<div class="form-group" id="form-group-c2">
						<label  class="c-p2">期望完成日期 <span>*</span></label>
						<!--<input type="text" class="form-control" name="lqrq"  readonly="readonly" onfocus="WdatePicker({minDate:'%y-%M-{%d}',disabledDays:[6,0],skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'{:date('Y-m-d',time()+3600*24*3)}'})" >-->
						<input type="text" class="form-control" name="lqrq"  readonly="readonly" value='{$info.lqrq}' onfocus="
						WdatePicker({minDate:'%y-%M-{%d}',disabledDays:[6,0],
						skin:'whyGreen',dateFmt:'yyyy-MM-dd',
						minDate:'{:date('Y-m-d',time()+3600*24*2)}',
						maxDate:'{:date('Y-m-d',time()+3600*24*28)}'})
						" >
						<div><span style="position: relative;left: 324px;top: -27px;color: red;">从当前日期算起，第2个基本工作日后日期可选</span></div>

					</div>
					<div class="fenggege"></div>
					<p class="c-p1">检索要求</p>
					<div class="form-group ">
						<label  class="c-p2">中文检索词<span>*</span></label>
						<textarea class="form-control" rows="3" placeholder="规范词、同义词、广义词、狭义词、相关词" name="keywords_cn"style="height: 200px ;width: 46%" >{$info.keywords_cn}</textarea>
					</div>
					<!-- =========================================== -->
					<div class="form-group wai_name" style="display: none; ">
						<label  class="c-p2">外文检索词<span>*</span></label>
						<textarea class="form-control waiwen" rows="3" placeholder="国外、国内外检索必填"  name="keywords_en" style="height: 200px ;width: 46%">{$info.keywords_en}</textarea>
					</div>
					<div class="form-group">
						<label  class="c-p2">检索数量备注</label>
						<textarea class="form-control" rows="3" placeholder="国内外相关文献量篇数、国内外密切相关文献量篇数" name="show_user_jf_pubdate" style="height: 200px ;width: 46%">{$info.show_user_jf_pubdate}</textarea>
					</div>

					<!-- =========================================== -->
					<p class="c-p1">其他</p>
					<div class="form-group"  id="form-group-c3">
						<label  class="c-p2">附件</label><br/>
						<input type='text' name='textfield' id='textfield' class="form-control_1" readonly="readonly" />
						<input type='button' class='btn_liu' value='选择文件' />
						<input type="hidden" name="sqfj" id="upload_icoB" value="{$info.sqfj}"/>
						<input type="file"   class="file_2" onchange="ajaxFileUpload('icoB');" id="icoB" name="icoB">
						<span style="color: red">(只支持.doc .rar后缀的文件)</span>
					</div>
					<div class="main_chaxin_1_2-8">
						<!--<span class="span2">查看文档</span><br/>-->
						<div id="show_upload_message_icoB" class="span2">
							<foreach name="sqfj_arr" item="vo" >
								<if condition="$vo neq ''">
									<div id="file_id_{$vo['id']}">
										<a style="color:blue;" target="_blank" href="{:U('down_file')}?file_id={$vo['id']}">{$vo.title}</a>
										&nbsp;&nbsp;&nbsp;&nbsp;
										<a style="color:blue;" href="javascript:del_file({$vo['id']},'icoB')">删除</a>
									</div>
								</if>
							</foreach>
						</div>
					</div>
					<!-- =========================================== -->
					<div class="form-group">
						<label  class="c-p2">其他说明</label>
						<textarea class="form-control" rows="3" placeholder=""  name="contents" style="height: 200px ;width: 46%">{$info.contents}</textarea>
					</div>
					<!-- =========================================== -->
					<div class="fenggege"></div>
					<div class="qianming">
						<div class="qianming-1">
							<p class="c-p1">委托人签名<span>*</span></p>
							<input type="text" class="form-control" name="wtr_name" placeholder=""	value="{$info.wtr_name}" readonly="readonly">
						</div>
						<div class="qianming-1">
							<p class="c-p1">委托时间</p>
							<input class="form-control" size="16" type="text" value="{$info.intime}" disabled>
						</div>

					</div>
					<div class="qianming1">
						<notempty name="info['cx_user_name']">
							<div class="qianming-2">
								<p class="c-p1">查新员签名</p>
								<input type="text" class="form-control" placeholder="" disabled>
							</div>
						</notempty>
						<if condition="$info['process_id'] eq 14">
							<div class="qianming-2">
								<p class="c-p1">完成时间</p>
								<input class="form-control" size="16" type="text" value="" disabled>
							</div>
						</if>
					</div>
					<input type="hidden" id="department_id" value="{$info.department_id}" name="department_id">
					<input type="hidden" id="department_id2" >
					<input type="hidden" name="id" value="{$info.id}">
					<input class="action-button ajax-post" value="保&nbsp;&nbsp;存" type="submit" target-form="form-hori">
				</form>
				<!-- =========form end============ -->
			</div>
		</div>
	</div>
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		 aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content" style="width: 600px">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">×
					</button>
					<h4 class="modal-title" id="myModalLabel">
						欢迎使用科技查新平台！
					</h4>
				</div>
				<div class="modal-body">
					<span class="tan_title">科技查新机构选择<a>（若您无需选择科技查新机构，请关闭该弹窗！）</a></span>
					<div>
						<div class="psanm">
							<div class="sejjr row">
								<div class="left-ps">南京地区</div>
								<div class="right-ps">
									<volist name="list" id="vo">
										<if condition="$vo['city'] eq '0'">
											<a  id="idselect_{$vo.fid}" <if condition="$vo['fid'] eq $info['department_id']">class="active1"</if> onclick="selectDeparId('{$vo.fid}','{$vo.fid|getAgencynameById}')" >{$vo.fid|getAgencynameById}</a>
										</if>
									</volist>
								</div>
							</div>
							<div class="sejjr row">
								<div class="left-ps">苏锡常地区</div>
								<div class="right-ps">
									<volist name="list" id="vo">
										<if condition="($vo['city'] lt 4) AND ($vo['city'] gt 0)">
											<a  id="idselect_{$vo.fid}"<if condition="$vo['fid'] eq $info['department_id']">class="active1"</if>  onclick="selectDeparId('{$vo.fid}','{$vo.fid|getAgencynameById}')" >{$vo.fid|getAgencynameById}</a>
										</if>
									</volist>
								</div>
							</div>
							<div class="sejjr row">
								<div class="left-ps">其他地区</div>
								<div class="right-ps">
									<volist name="list" id="vo">
										<if condition="$vo['city'] gt 3">
											<a  id="idselect_{$vo.fid}"<if condition="$vo['fid'] eq $info['department_id']">class="active1"</if>  onclick="selectDeparId('{$vo.fid}','{$vo.fid|getAgencynameById}')" >{$vo.fid|getAgencynameById}</a>
										</if>
									</volist>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer" style="text-align: center;">
					
					<button type="button" class="btn btn-primary" data-dismiss="modal"  onclick="show_name(1)">
						确定
					</button>
					<button type="button" class="btn btn-primary" data-dismiss="modal"  onclick="show_name(2)">
						取消机构
					</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->
	</div><!-- /.modal -->
	<style>
		table tr td:nth-child(1) {
			text-align: right;
			width: 20%;
		}
		table tr{
			height: 23px;
		}


		.tan_title{
			color: #15b2a9;
		}
		.tan_title a{
			color: #8c8c8c;
		}
		.modal-title{
			color: #15b2a9;
		}

		.fenfen{
			float: left;
			width: 490px;
			overflow: hidden;
		}
		.diqu{
			width: 100%;
			height: auto;
			margin-top: 20px;
		}
		.diqu span{
			font-size: 15px;
			color: #3c3c3c;
			float: left;
		}
		.diqu a{
			color:#15b2a9;
			padding: 3px 6px;
			border-radius: 2px;
			margin-bottom: 7px;

		}
		.diqu li .active1{
			background-color:#15b2a9;
			color: #fff;
		}
		.diqu .active1{
			background-color:#15b2a9;
			color: #fff;
		}
		.diqu a:hover{
			color: #fff;
			background-color:#15b2a9;
		}
		.diqu ul li{
			float: left;
			width: 33%;
			margin-bottom: 7px;
		}
		.fenfen1{
			float: left;
			width: 490px;
			overflow: hidden;
		}
		.fenfen2{
			float: left;
			width: 490px;
			overflow: hidden;
		}
		.modal.in .modal-dialog{
			top:20%
		}
		li{
			list-style: none;
		}
		.btn.btn-primary:hover, .btn.btn-primary:focus, .btn.btn-primary:active, .btn.btn-primary.active{
			background: #15b2a9;
		}
		.btn.btn-primary{
			background: #15b2a9;
			border: 1px solid #15b2a9;;
		}
		.psanm .sejjr {
			margin-top: 10px;
			padding-bottom: 10px;
			border-bottom: 1px dotted #ddd;
		}
		.left-ps {
			float: left;
			width: 100px;
			color: #15b2a9;
			font-size: 15px;
			font-weight: 600;
		}
		.right-ps {
			width: 450px;
			float: left;

		}
		.right-ps a {
			padding: 3px 6px;
			border-radius: 2px;
			margin-bottom: 7px;
			display: inline-block;
			margin-right: 11px;
		}
		.right-ps a:hover{
			background-color: #15b2a9;
			color: #fff;
			cursor: pointer;
		}
		.active1 {
			background-color: #15b2a9;
			color: #fff !important;
		}
	</style>
</block>

<block name="script">
	<!--<script src="__STATIC__/jquery/jquery.min.js"></script>-->
	<script src="__STATIC__/easing.jquery.js" type="text/javascript"></script>
	<!--<script src="__JS__/zzsc2.js" type="text/javascript"></script>-->
	<script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
	<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>
	<!--<script src="__STATIC__/bootstrap/js/bootstrap.min.js"></script>-->
	<script>
		$(function(){
			//学科改变时的选择
			$('#subject_change').change(function () {
				var value = $(this).val();
				var url = '{:U("Task/subject")}';
				$.ajax({
					type: "POST",
					url: url,
					data: {fid: value},
					dataType: "json",
					success: function (data) {
						$('#sub_list').empty();   //清空cate_list里面的所有内容
						var html = '';

						if(data.state==1){
							html += '<span style="margin-right: 0;padding-left: 30px;" class="c-p2">二级学科</span>';
							html += '<select style="width: 192px;margin-right: 10px;display: inline-block" name="xkfl" class="form-control">';
							for(var i=0;i<data.list.length;i++){
								html +="<option value='"+data['list'][i]['id']+"'>"+data['list'][i]['title']+"</option>";
							}
							html += '</select>';
						}else{
							layer.alert('请在后台添加二级学科！');
						}
						$('#sub_list').html(html);
					}
				});
			})
			highlight_nav2('{:U("Task/index")}');
			//判断其他显示
			var str = "<?php $arr = implode(',',$cxmd_arr);echo $arr;?>";
			if(str.indexOf('6') != '-1' ){
				$('#cxmd_other').show();
				$('#other_6').attr('data_dd','2')
			}
			if(str.indexOf('1') != '-1' ){
				$('#xxcxmd').show();
				$('#other_1').attr('data_dd','2')
			}
			//查新要求
			var arr = "<?php echo $info['cxyq'];?>";
			if(arr.indexOf('3') != '-1'){
				$('#qtyq').show();
				$('#qtyq22').attr('data_dd','2')
			}
		})

		var value = '';

		function selectDeparId(id,name){
			if(id){
				$("#department_id").val(id);
//			$("#chose_jg").val(name);
				$(".right-ps a").removeClass("active1");
				$("#idselect_"+id).addClass('active1');
			}
		}

		//点击确认的时候把值传到前台并且关闭
		function show_name(id){
			if(id == 1)
			{
				var name = $('.right-ps a.active1').text();
				$("#chose_jg").val(name);
			}
			else    //取消选择
			{
				$('.right-ps a.active1').removeClass('active1');
				$("#chose_jg").val('');
				$("#department_id").val('');
			}
		}


		//显示其他
		function other_mu (obj) {
			var name= $(obj).attr('data_dd');
			if(name==1){
				$('#cxmd_other').show();
				$(obj).attr('data_dd','2')
			}else{
				$('#cxmd_other').hide();
				$(obj).attr('data_dd','1')
			}
		}
		//显示其他要求
		function other_cxyq (obj) {
			var name= $(obj).attr('data_dd');
			if(name==1){
				$('#qtyq').show();
				$(obj).attr('data_dd','2')
			}else{
				$('#qtyq').hide();
				$(obj).attr('data_dd','1')
			}
		}

		$(function(){
			highlight_nav2('{:U('Task/edit')}');
			var guo    = $('input[name="cxfw"]:checked').val();
			if(guo != 1){  //点击的是国内
				$('.zhong_name').show();
				$('.wai_name').show();
			}

		});
		//提交判断
		function click_submit(){
			var name   =$("input[name='xmmcen']");//项目名称英文
			var fanwei =$("input[name='xmmc']");//项目名称中文
			var show   = $("textarea[name='show_add_cxd']");
			var jsd    = $("textarea[name='jsd']");
			var xxcxmd = $(".xxcxmd");
			var lqrq   = $("input[name='lqrq']").val();
			var cxmd   = $("input[name='cxmd[]']:checked");
			var cxyq   = $("input[name='cxyq[]']:checked");
			var guo    = $('input[name="cxfw"]:checked').val();
			var keywords_cn = $('textarea[name="keywords_cn"]');
			var keywords_en = $('textarea[name="keywords_en"]')
			var dwsh        = $("input[name='dwsh']:checked").val();
			var qbfs        = $("input[name='qbfs']:checked").val();

			if(fanwei.val() == ''){
				alert('请填写项目中文名称');
				fanwei.focus();
				return false;
			}
			if(guo != 1){  //点击的是国内
				if(name.val() == ''){
					alert('请填写项目英文名称');
					name.focus();
					return false;
				}
			}

			if(!cxmd.length){
				alert('请选择查新目的');
				return false;
			}
			//判断是否要输入目的
			if($('.show_action').attr('data_dd') == 2){
				if(xxcxmd.val()==''){
					alert('请填写查新目的');
					xxcxmd.focus();
					return false;
				}
			}
			if(show.val() == ''){
				alert('请填写查新点');
				show.focus();
				return false;
			}
			if(jsd.val() == ''){
				alert('请填写技术要求');
				jsd.focus();
				return false;
			}
			if(!cxyq.length){
				alert('请选择查新要求');
				return false;
			}
			if(lqrq == ''){
				alert('请填写完成日期');
				return false;
			}
			if(keywords_cn.val() == ''){
				alert('请填写中文检索词');
				keywords_cn.focus();
				return false;
			}
			if(guo != 1){
				if(keywords_en.val() == ''){
					alert('请填写外文检索词');
					keywords_en.focus();
					return false;
				}
			}
//			$.getScript('__STATIC__/common.js');
		}
		//显示中英文
		function click_name(){
			var name = $("input[name='cxfw']:checked").val();
			if(name == 1){
				$('.zhong_name').show();
				$('.wai_name').hide();
			}else if(name == 2){
				$('.zhong_name').show();
				$('.wai_name').show();
			}else{
				$('.zhong_name').show();
				$('.wai_name').show();
			}
		}

		//科研目的
		function research (obj) {
			var name= $(obj).attr('data_dd');
			if(name==1){
				alert('请填写详细查新目的');
				$('#xxcxmd').show();
				$(obj).attr('data_dd','2')
			}else{
				$('#xxcxmd').hide();
				$(obj).attr('data_dd','1')
			}
		}
		function xk_(){
			$("option:selected").each(function(){
				var xk_select=$(this).val();
				var xk_qt=$("input[name='show_cx_type']").val();
				if(xk_select){
					$(".xk").attr({disabled:true});
				}else{
					$(".xk").removeAttr("disabled");
				}
				if(xk_qt){
					$(".xk_s").attr({disabled:true});
				}else{
					$(".xk_s").removeAttr("disabled");
				}
			});
		}

	</script>


</block>
